<?php

/**
 * This is the model class for table "kodo_kodostudios_fb_metadata".
 */
require_once(dirname(__FILE__).'/base/FbMetadataBase.php');
class FbMetadata extends FbMetadataBase
{
    /**
     * @return array validation rules for model attributes.
     */
    public function rules()
    {
        return array(
            array('title, url, type', 'required'),
            array('title, url, image, site_name', 'length', 'max'=>255),
            array('type', 'length', 'max'=>20),
            array('creation_datetime, last_update', 'safe'),
            array('id, title, url, type, image, site_name', 'safe', 'on'=>'search'),
        );
    }
    
    protected function beforeSave()
    {
        if ($this->getIsNewRecord())
            $this->creation_datetime = date('Y-m-d H:i:s');
        $this->last_update = date('Y-m-d H:i:s');
        return parent::beforeSave();
    }
}